all: xforce

OISDIST=../wgoisdist

##############################
#######  TARGET: xforce
##############################
TOP_xforce=./src
WD_xforce=$(shell cd ${TOP_xforce};echo `pwd`)
cpp_SRC_xforce+=${WD_xforce}/xforce.cpp
#c_SRC_xforce+=${WD_xforce}/ff-control.c

#OBJS_xforce+=$(c_SRC_xforce:.c=.c.o)

OBJS_xforce+=$(cpp_SRC_xforce:.cpp=.cpp.o)

CFLAGS_xforce+= -I./\
 -I./external/SDK/CHeaders/XPLM\
 -I./src\
 -I./external/SDK/CHeaders/Widgets\
 -I${OISDIST}/include/OIS\
 -I- -I/usr/include/\
 -DIBM=0 -DAPL=0 -DLIN=1

DBG=-g

CFLAGS_xforce+=-O0 -x c++ -ansi

clean_xforce:
	rm -f ${OBJS_xforce}

xforce:
	$(MAKE) -f Makefile xforce.xpl TARGET=xforce.xpl\
	CC="g++"  LD="g++"  AR="ar -crs"  SIZE="size" LIBS+="-lGL -lGLU ./external/WidgetLibraryExample/Binaries/LinuxGCC/XPWidgetsEx.lib ${OISDIST}/lib/libOIS.a"

xforce.xpl: ${OBJS_xforce}
	${CC} -shared ${LDFLAGS} -o Release/Resources/plugins/xforce.xpl ${OBJS_xforce} ${LIBS}


#ifeq (${TARGET}, xforce.xpl)

%.cpp.o: %.cpp
	gcc -c -fPIC ${CFLAGS_xforce} $< -o $@ -MMD
include $(cpp_SRC_xforce:.cpp=.dd)

%.dd: %.cpp
	set -e; $(CC) -M $(CFLAGS_xforce) $< \
 | sed 's!\($(*F)\)\.o[ :]*!$(*D)/\1.o $@ : !g' > $@; \
 [ -s $@ ] || rm -f $@

%.c.o: %.c
	gcc -c -fPIC ${CFLAGS_xforce} $< -o $@ -MMD
include $(c_SRC_xforce:.c=.d)

%.d: %.c
	set -e; $(CC) -M $(CFLAGS_xforce) $< \
 | sed 's!\($(*F)\)\.o[ :]*!$(*D)/\1.o $@ : !g' > $@; \
 [ -s $@ ] || rm -f $@

#endif
